package day10test01;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class StudnetTest {
    public static void main(String[] args) {
        Map<Student,String> map=new HashMap<>();
        Student stu=new Student("黄超",23);
        Student stu1=new Student("黄胜",21);
        Student stu2=new Student("黄赞",20);
        Student stu3=new Student("黄靖",18);
        map.put(stu,"北京");
        map.put(stu1,"天津");
        map.put(stu2,"日本");
        map.put(stu3,"上海");
        Set<Map.Entry<Student, String>> entries = map.entrySet();
        for (Map.Entry<Student, String> entry : entries) {
            Student key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key + "住在"+value);
            System.out.println("-----");
        }
       map.forEach((key,value)->
           System.out.println(key+value)

       );
        System.out.println("-------");
        Set<Student> students = map.keySet();
        for (Student student : students) {
            String s = map.get(student);
            System.out.println(student+s);
        }

    }
}
